package com.jf.blog_jf04.data;

import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;

import java.util.List;

@Data
@ApiModel("分页数据类")
public class PageInfo {
    @ApiModelProperty(required = true, value = "当前页", example = "1")
    private Long page;
    @ApiModelProperty(required = true, value = "每页条数", example = "5")
    private Long limit;
    @ApiModelProperty(hidden = true)
    private Long total;
    @ApiModelProperty(hidden = true)
    private List<?> list;

    public PageInfo() {
    }

    public PageInfo(long page, long limit) {
        this.page = page;
        this.limit = limit;
    }

    public PageInfo setPageInfo(long total, List<?> list) {
        this.total = total;
        this.list = list;
        return this;
    }

    public Page setPage() {
        return new Page<>(this.page, this.limit);
    }
}
